/*
 * Copyright (c) 2023, 2024,yzc.cn All rights reserved.
 *
 */
package cn.yzc.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import yui.comn.mybatisx.extension.injector.SoftSqlInjector;
import yui.comn.mybatisx.extension.plugins.inner.PaginationCacheInterceptor;


/**
 * <p>Project: mybatis-linkDemo - MybatisLinkConfig</p>
 * <p>Powered by yzc On 2024-05-14 14:29:13</p>
 * <p>描述：<p>
 *
 * @author yzc [youzhicheng0415@163.com]
 * @version 1.0
 * @since 17
 */
@Configuration
public class MybatisLinkConfig {
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationCacheInterceptor(DbType.MYSQL));
        return interceptor;
    }
    @Bean
    public ISqlInjector sqlInjector() {
        return new SoftSqlInjector(); // 自定义注入类
    }
}
